<template>
  <elm-page-tb>
    <template #top>
      <el-input placeholder="请查询输入内容" prefix-icon='el-icon-search' size="mini" style="width: 250px;" v-model="postData.nick_name" clearable></el-input>
      <el-select v-model="postData.oper_type" placeholder="请选择访问来源" size="mini" style="width: 250px; margin-left: 10px;" clearable>
        <el-option
            v-for="item in oper_types"
            :key="item.value"
            :label="item.label"
            :value="item.value">
        </el-option>
      </el-select>
      <right>
        <el-button-group>
          <el-button icon="el-icon-search" size="mini" @click="tablebinding()">查询</el-button>
        </el-button-group>
      </right>
    </template>
    <elm-table url="/system/login/log/GetData" :post-data="postData">
      <el-table-column prop="nick_name" label="操作人" width="180px" align="center"></el-table-column>
      <el-table-column prop="menu_title" label="访问路径" align="center"></el-table-column>
      <el-table-column prop="msg" label="操作信息" align="left" header-align="center"></el-table-column>
      <el-table-column prop="oper_type" :formatter="parseType" label="访问来源"  width="100px" align="center"></el-table-column>
      <el-table-column prop="oper_time" :formatter="formatDateTime" label="操作时间"  width="200px" align="center"></el-table-column>
      <el-table-column fixed="right" label="操作" width="80px" align="center">
        <template v-slot="scope">
          <elm-delete-button type="text" size="mini" url="/system/login/log/Delete" :data="{ id: scope.row.id }">删除</elm-delete-button>
        </template>
      </el-table-column>
    </elm-table>
  </elm-page-tb>
</template>

<script>
export default {
  extends: elmVueBase,
  data() {
    return {
      postData: { nick_name: null },
      oper_types: [
        { value: "0", label: "PC端" },
        { value: "1", label: "手机端" },
        { value: "2", label: "钉钉" },
        { value: "3", label: "企业微信" },
      ],
    }
  },
  created() {
  },
  methods: {
    parseType(row, column) {
      if (row.oper_type == "0") {
        return "PC";
      } else if (row.oper_type == "1") {
        return "手机";
      } else if (row.oper_type == "2") {
        return "钉钉";
      } else if (row.oper_type == "3") {
        return "企业微信";
      } else {
        return "未知";
      }
    },
  }
}
</script>

<style scoped>
</style>